package com.lmb.service.impl;

import com.lmb.bean.Families;
import com.lmb.mapper.FamiliesDao;
import com.lmb.service.FamiliesService;
import com.lmb.util.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FamiliesServiceImpl implements FamiliesService {
    @Autowired
    FamiliesDao familiesDao;

    @Override
    public Families add(Families families) {
        familiesDao.add(families);
        Families result=familiesDao.one(families.getFamily_id());
        return result;
    }

    @Override
    public Families edit(Families families) {
        familiesDao.edit(families);
        Families result=familiesDao.one(families.getFamily_id());
        return result;
    }

    @Override
    public int del(Integer id) {
        return familiesDao.del(id);
    }

    @Override
    public Families one(Integer id) {
        return familiesDao.one(id);
    }

    @Override
    public List<Families> all(Families families) {

        return familiesDao.all(families);
    }

    @Override
    public void page(Page page, Families families) {
        int count= familiesDao.pageCount(families);
        Object data= familiesDao.page(page, families);
        page.setCount(count);
        page.setData(data);
    }
}
